package com.zhang.sharding.controller;

import com.zhang.sharding.entity.GlobalEventLog;
import com.zhang.sharding.entity.Order;
import com.zhang.sharding.service.GlobalEventLogService;
import com.zhang.sharding.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
public class GlobalEventLogController {

    @Resource
    private GlobalEventLogService globalEventLogService;

    @Resource
    private OrderService orderService;

    @GetMapping("/insert")
    public void insert(@RequestBody GlobalEventLog globalEventLog) {
        String eventName = "test";
        globalEventLogService.insertLog(globalEventLog);
    }

    @GetMapping("/select")
    public List<GlobalEventLog> select() {
        return globalEventLogService.getAllLogs();
    }

    @GetMapping("/orders")
    public List<Order> selectOrder() {
        return orderService.getAllOrders();
    }



}
